#!/bin/sh
######################
#
# It's nesseray that to run SMW before this module 
#
######################
FOLDER=convert_SMW_to_return

mv *.SMW ${FOLDER}
mv all.array.top50 ${FOLDER}
cd ${FOLDER}

# generate convert_SMW_to_return.sh
echo "#!/bin/sh" > ${FOLDER}.sh
echo 'echo "convert_SMW_to_return ing~~"' >> ${FOLDER}.sh
cat all.array.top50 >> ${FOLDER}.sh
filenames=`wc -l all.array.top50 | awk '{print $1}'`
#####
echo "i=0
while [ \$i -le $((filenames-1)) ]" >> ${FOLDER}.sh
#####
cat ${FOLDER}.tample.sh >> ${FOLDER}.sh

chmod a+x *.sh
./${FOLDER}.sh

